package iscte.ai.kcgtd;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class SeeCategories extends Activity implements OnItemClickListener{
	public static final int[] optionsIcons = {
		R.drawable.projects_icon,
		R.drawable.notes_edit,
		R.drawable.edit};
	public static final int PROJECTOS_INDEX = 0;
	public static final int LAZER_INDEX = 1;
	public static final int COMPRAS_INDEX = 2;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.list);

		String[] options = MainActivity.CATEGORIAS;
		ListView list = (ListView) findViewById(R.id.list);
		ViewAdapter adapter = new ViewAdapter(this, R.layout.category_item,options , optionsIcons);
		list.setAdapter(adapter);
		list.setOnItemClickListener(this);
	}
	@Override
	public void onItemClick(AdapterView<?> adapter, View view, int position, long arg3) {
		Intent 	intent = new Intent("android.intent.action.SeeTasks");

		switch (position) {
		case PROJECTOS_INDEX:
			intent.putExtra("iscte.ai.kcgtd.tarefas_para_mostrar", MainActivity.CATEGORIA_PROJECTOS);
			break;		
		case LAZER_INDEX:
			intent.putExtra("iscte.ai.kcgtd.tarefas_para_mostrar", MainActivity.CATEGORIA_LAZER);
			break;		
		case COMPRAS_INDEX:
			intent.putExtra("iscte.ai.kcgtd.tarefas_para_mostrar", MainActivity.CATEGORIA_COMPRAS);
			break;

		default:
			break;

		}
		startActivity(intent);

	}
}
